#include <iostream>
#include <fstream>
#include <sys/stat.h>
#include <ctime>

long getFileSize(const std::string& filePath) {
    std::ifstream file(filePath.c_str(), std::ios::binary | std::ios::ate);
    if (file) {
        return file.tellg();
    } else {
        std::cerr << "Unable to open file: " << filePath << std::endl;
        return -1;
    }
}

std::string getLastModificationTime(const std::string& filePath) {
    struct stat fileInfo;
    if (stat(filePath.c_str(), &fileInfo) == 0) {
        std::time_t modTime = fileInfo.st_mtime;
		std::cout << "time" << fileInfo.st_size << std::endl;
        return std::ctime(&modTime);
    } else {
        std::cerr << "Unable to get file information: " << filePath << std::endl;
        return "";
    }
}

int main() {
    std::string filePath = "/mnt/hgfs/test/src/file_info/file_info.cpp";
    
    long fileSize = getFileSize(filePath);
    if (fileSize != -1) {
        std::cout << "File size: " << fileSize << " bytes" << std::endl;
    }

    std::string modTime = getLastModificationTime(filePath);
    if (!modTime.empty()) {
        std::cout << "Last modification time: " << modTime ;
    }

    return 0;
}
